#!/bin/bash

if [ ! "$1" ]
then
    echo 'Use: mbs_viewlog <system>'
    exit 1
fi
SYSTEM="$1"

# Get the absolute packet dir
OLDPWD="$PWD"
cd "$PACKETDIR"
PACKETDIR="$PWD"
cd "$OLDPWD"

cd "`dirname $0`"

# Make sure the system exists
if [ ! -e "systems/$SYSTEM/system" ]
then
    echo 'System '$SYSTEM' does not exist.'
    exit 1
fi

# Load in the system
. systems/"$SYSTEM"/system

# Show it
xterm -T "$SYSTEM" -e tail -f "$SYS_DIR"/log.txt &
